package com.googlecode.cardamomo.jaxb;

import javax.xml.bind.annotation.adapters.XmlAdapter;

/**
 * IntegerAdapter provides:
 * - Default value for Integer attributes is "0"
 * 
 * @author jtorne
 *
 */
public class IntegerAdapter extends XmlAdapter<Integer, Integer> {

	@Override
	public Integer unmarshal(Integer v) throws Exception {
		return v;
	}

	@Override
	public Integer marshal(Integer v) throws Exception {
		if (v == 0)
			return null;
		return v;
	}

}
